package com.bestcem.xm.common.core.constant;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * 公共常量类
 *
 * @author zhenz
 * @date 2020/6/1 18:51
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Constants {

    /**
     * 点
     */
    public static final String DOT = ".";

    /**
     * 中划线
     */
    public static final CharSequence HYPHEN = "-";

    /**
     * 空格
     */
    public static final CharSequence SPACE = " ";

    /**
     * 零
     */
    public static final int ZERO = 0;

    /**
     * 一
     */
    public static final int ONE = 1;

    /**
     * 二
     */
    public static final int TWO = 2;

    /**
     * -1
     */
    public static final String NEGATIVE_ONE_STR = "-1";

    /**
     * True
     */
    public static final boolean TRUE = true;

    /**
     * 成功
     */
    public static final int SUCCESS = 0;

    /**
     * 失败
     */
    public static final int ERROR = 1;

    /**
     * 失败
     */
    public static final int FAIL = -1;

    /**
     * 从数据库中加载LabelValue每页最大条数
     */
    public static final int LABEL_VALUE_PAGE_SIZE = 200;

    /**
     * 标签值最大数量
     */
    public static final int LABEL_VALUE_MAX = 30;

    //标签组最大长度
    public static final int TAG_GROUP_MAX_LEN = 20;

    //标签组名最大长度
    public static final int TAG_GROUP_NAME_MAX_LEN = 30;

    /**
     * 标签名最大长度
     */
    public static final int LABEL_NAME_MAX_LEN = 30;

    /**
     * 标签值名称最大长度
     */
    public static final int LABEL_VALUE_NAME_MAX_LEN = 30;

    /**
     * 自动打标签条件，每个条件组最多包含5个条件或条件组
     */
    public static final int MAX_SIBLING_CONDITION_NUM = 5;

    /**
     * 自动打标签，上下文中，问卷相关条件Map初始大小
     */
    public static final int SURVEY_CONDITION_INITIAL_CAPACITY = 128;

    /**
     * 最大标签嵌套深度
     */
    public static final int MAX_NESTED_LABEL_LEVEL = 3;

    /**
     * 文本分析模块名称
     */
    public static final String TXTANLS_MODEL_NAME = "txtanls";

    /**
     * utf-8
     */
    public static final String UTF_8 = "utf-8";

    /**
     * 前端传递的话题组字符串和话题字符串
     */
    public static final String TOPIC_GROUP = "TOPICS_GROUP";
    public static final String TOPIC = "TOPICS";

    /**
     * 前端传递的观点组字符串和观点字符串
     */
    public static final String VIEW_GROUP = "VIEW_GROUP";
    public static final String VIEW = "VIEW";

    /**
     * 前端传递的观点的好评和差评字符串
     */
    public static final String GOOD = "HIGH";
    public static final String BAD = "BAD";

    /**
     * 图标导出时替换的字段
     */
    public static final String CHART_NAME = "name";

    /**
     * 失败
     */
    public static final Integer ERROR_CODE = 0;

    public static final String BI_WORKTABLE_CHANGED_TOPIC = "bi.worktable_changed";
    public static final String BI_COLUMN_CHANGED_TOPIC = "bi.column_changed";
    public static final String USER_FREE_ORG_CREATED_NAME_TOPIC = "user.free_org_created";
    public static final String TXTANLS_QUEUE_NAME = "txtanls";

    /**
     * 成功
     */
    public static final Integer SUCCESS_CODE = 1;

    /**
     * int 数字 10
     */
    public static final int TEN = 10;

    /**
     * int 数字20
     */
    public static final int TWENTY = 20;

    /**
     * 默认话题组名
     */
    public static final String DEFAULT_TOPIC_GROUP_NAME = "未分组";

    /**
     * 空字符串
     */
    public static final String EMPTY = "";


    /**
     * 页面传输Null字符串
     */
    public static final String NULL = "Null";

    /**
     * 多少行数据调情感接口
     */
    public static final int REQUEST_NUMBER = 20;

    /**
     * 按多少行更新训练进度
     */
    public static final int PROGRESS_COUNT = 500;

    /**
     * 时间格式
     */
    public static final String TIME_FORMAT = "yyyy-MM-dd 23:59:59";

    /**
     * 日期格式
     */
    public static final String DATE_FORMAT = "yyyy-MM-dd";

    /**
     * 重试间隔时间ms,默认1000ms
     */
    public static final long FIXED_PERIOD_TIME = 2000L;

    /**
     * 最大重试次数,默认为3
     */
    public static final int MAX_RETRY_TIME = 3;

    /**
     * 训练完成未开始 训练进度默认值
     */
    public static final Integer PROGRESS_NOT_START = -1;

    /**
     * 训练完成 训练进度默认值
     */
    public static final Integer PROGRESS_FINISHED = 0;

    /**
     * clickhouse查询条数
     */
    public static final Integer LIMIT = 1000;

    /**
     * index 0
     */
    public static final int INT_ZERO = 0;

    public static final long LONG_ZERO = 0L;

    /**
     * 正则匹配或字符
     */
    public static final String OR = "|";

    /**
     * 默认数组长度
     */
    public static final int DEFAULT_ARRAY_SIZE = 10;

    /**
     * 默认map长度
     */
    public static final int DEFAULT_MAP_SIZE = 16;

    /**
     * xlsx文件后缀
     */
    public static final String XLSX_SUFFIX = "xlsx";

    /**
     * excel响应类型
     */
    public static final String EXCEL_CONTENT_TYPE = "application/vnd.ms-excel;charset=utf-8";


    /**
     * int 19
     */
    public static final int NINETEEN = 19;

    /**
     * 未分组常量
     */
    public static final String UN_GROUP = "未分组";


    /**
     * 前端展示用项目训练状态-等待中
     */
    public static final int PROJECT_STATUS_UN_TRAIN = 0;

    /**
     * 前端展示用项目训练状态-训练中
     */
    public static final int PROJECT_STATUS_TRAINING = 1;

    /**
     * 前端展示用项目训练状态-训练完成
     */
    public static final int PROJECT_STATUS_FINISH_TRAIN = 2;


    /**
     * 前端展示用项目训练状态-训练失败
     */
    public static final int PROJECT_STATUS_FAIL = 3;

    /**
     * 周期对应的开始月和日
     */
    public static final Map<String, String> QUARTER_START_TIME_MAP = new HashMap<>();
    /**
     * 默认扫描路径
     */
    public static final String XM_COMMON_PACKAGE = "com.bestcem.xm.common.core";
    public static final String XM_TXTANS_PACKAGE = "com.bestcem.xm.txtanls";
    public static final String XM_TXTANS_MAPPER_PACKAGE = "com.bestcem.xm.txtanls.dao.mapper";

    public static final String XM_TICKET_PACKAGE = "com.bestcem.xm.ticket";
    public static final String XM_TICKET_MAPPER_PACKAGE = "com.bestcem.xm.ticket.dao.mapper";

    public static final String XM_SCRIPT_PACKAGE = "com.bestcem.xm.script";
    public static final String XM_LABEL_PACKAGE = "com.bestcem.xm.label";
    public static final String XM_LABEL_MAPPER_PACKAGE = "com.bestcem.xm.label.dao.mapper";
    public static final String XM_MEMBER_PACKAGE = "com.bestcem.xm.member";
    public static final String XM_MEMBER_MAPPER_PACKAGE = "com.bestcem.xm.member.dao.mapper";

    public static final String XM_AWARD_PACKAGE = "com.bestcem.xm.award";
    public static final String XM_AWARD_MAPPER_PACKAGE = "com.bestcem.xm.award.dao.mapper";
    public static final String XM_SIGN_MAPPER_PACKAGE = "com.bestcem.xm.common.core.dao.mapper";

    public final static String SYNC_RULE_CACHE_KEY = "syncRule:{}_{}";

    static {
        QUARTER_START_TIME_MAP.put("Q1", "01-01");
        QUARTER_START_TIME_MAP.put("Q2", "04-01");
        QUARTER_START_TIME_MAP.put("Q3", "07-01");
        QUARTER_START_TIME_MAP.put("Q4", "10-01");
    }

    public static final String SEPARATOR = "/";
}
